﻿using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a k-NearestNeighbor OCR classifier.</summary>
	// Token: 0x02000053 RID: 83
	[Serializable]
	public class HOCRKnn : HHandle, ISerializable, ICloneable
	{
		// Token: 0x06000BE6 RID: 3046 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HOCRKnn() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x06000BE7 RID: 3047 RVA: 0x0004B39C File Offset: 0x0004959C
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HOCRKnn(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06000BE8 RID: 3048 RVA: 0x0004B3AB File Offset: 0x000495AB
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HOCRKnn(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06000BE9 RID: 3049 RVA: 0x0004B3BA File Offset: 0x000495BA
		private void AssertSemType()
		{
			base.AssertSemType("ocr_knn");
		}

		// Token: 0x06000BEA RID: 3050 RVA: 0x0004B3C7 File Offset: 0x000495C7
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HOCRKnn obj)
		{
			obj = new HOCRKnn(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x06000BEB RID: 3051 RVA: 0x0004B3E0 File Offset: 0x000495E0
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HOCRKnn[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HOCRKnn[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HOCRKnn(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Read an OCR classifier from a file.
		///   Modified instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000BEC RID: 3052 RVA: 0x0004B450 File Offset: 0x00049650
		public HOCRKnn(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(650);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create an OCR classifier using a k-Nearest Neighbor (k-NN) classifier.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="widthCharacter">Width of the rectangle to which the gray values of the segmented character are zoomed. Default: 8</param>
		/// <param name="heightCharacter">Height of the rectangle to which the gray values of the segmented character are zoomed. Default: 10</param>
		/// <param name="interpolation">Interpolation mode for the zooming of the characters. Default: "constant"</param>
		/// <param name="features">Features to be used for classification. Default: "default"</param>
		/// <param name="characters">All characters of the character set to be read. Default: ["0","1","2","3","4","5","6","7","8","9"]</param>
		/// <param name="genParamName">This parameter is not yet supported. Default: []</param>
		/// <param name="genParamValue">This parameter is not yet supported. Default: []</param>
		// Token: 0x06000BED RID: 3053 RVA: 0x0004B49C File Offset: 0x0004969C
		public HOCRKnn(int widthCharacter, int heightCharacter, string interpolation, HTuple features, HTuple characters, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(654);
			HalconAPI.StoreI(proc, 0, widthCharacter);
			HalconAPI.StoreI(proc, 1, heightCharacter);
			HalconAPI.StoreS(proc, 2, interpolation);
			HalconAPI.Store(proc, 3, features);
			HalconAPI.Store(proc, 4, characters);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HalconAPI.UnpinTuple(characters);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create an OCR classifier using a k-Nearest Neighbor (k-NN) classifier.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="widthCharacter">Width of the rectangle to which the gray values of the segmented character are zoomed. Default: 8</param>
		/// <param name="heightCharacter">Height of the rectangle to which the gray values of the segmented character are zoomed. Default: 10</param>
		/// <param name="interpolation">Interpolation mode for the zooming of the characters. Default: "constant"</param>
		/// <param name="features">Features to be used for classification. Default: "default"</param>
		/// <param name="characters">All characters of the character set to be read. Default: ["0","1","2","3","4","5","6","7","8","9"]</param>
		/// <param name="genParamName">This parameter is not yet supported. Default: []</param>
		/// <param name="genParamValue">This parameter is not yet supported. Default: []</param>
		// Token: 0x06000BEE RID: 3054 RVA: 0x0004B538 File Offset: 0x00049738
		public HOCRKnn(int widthCharacter, int heightCharacter, string interpolation, string features, HTuple characters, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(654);
			HalconAPI.StoreI(proc, 0, widthCharacter);
			HalconAPI.StoreI(proc, 1, heightCharacter);
			HalconAPI.StoreS(proc, 2, interpolation);
			HalconAPI.StoreS(proc, 3, features);
			HalconAPI.Store(proc, 4, characters);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(characters);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		// Token: 0x06000BEF RID: 3055 RVA: 0x0004B5D0 File Offset: 0x000497D0
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = this.SerializeOcrClassKnn();
			byte[] value = hserializedItem;
			hserializedItem.Dispose();
			info.AddValue("data", value, typeof(byte[]));
		}

		// Token: 0x06000BF0 RID: 3056 RVA: 0x0004B608 File Offset: 0x00049808
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HOCRKnn(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = new HSerializedItem((byte[])info.GetValue("data", typeof(byte[])));
			this.DeserializeOcrClassKnn(hserializedItem);
			hserializedItem.Dispose();
		}

		/// <summary>Serialize object to binary stream in HALCON format</summary>
		// Token: 0x06000BF1 RID: 3057 RVA: 0x0004B648 File Offset: 0x00049848
		public new void Serialize(Stream stream)
		{
			HSerializedItem hserializedItem = this.SerializeOcrClassKnn();
			hserializedItem.Serialize(stream);
			hserializedItem.Dispose();
		}

		/// <summary>Deserialize object from binary stream in HALCON format</summary>
		// Token: 0x06000BF2 RID: 3058 RVA: 0x0004B65C File Offset: 0x0004985C
		public new static HOCRKnn Deserialize(Stream stream)
		{
			HOCRKnn hocrknn = new HOCRKnn();
			HSerializedItem hserializedItem = HSerializedItem.Deserialize(stream);
			hocrknn.DeserializeOcrClassKnn(hserializedItem);
			hserializedItem.Dispose();
			return hocrknn;
		}

		// Token: 0x06000BF3 RID: 3059 RVA: 0x0004B682 File Offset: 0x00049882
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		// Token: 0x06000BF4 RID: 3060 RVA: 0x0004B68C File Offset: 0x0004988C
		public new HOCRKnn Clone()
		{
			HSerializedItem hserializedItem = this.SerializeOcrClassKnn();
			HOCRKnn hocrknn = new HOCRKnn();
			hocrknn.DeserializeOcrClassKnn(hserializedItem);
			hserializedItem.Dispose();
			return hocrknn;
		}

		/// <summary>
		///   Classify a related group of characters with an OCR classifier.
		///   Instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <param name="character">Characters to be recognized.</param>
		/// <param name="image">Gray values of the characters.</param>
		/// <param name="expression">Expression describing the allowed word structure.</param>
		/// <param name="numAlternatives">Number of classes per character considered for the internal word correction. Default: 3</param>
		/// <param name="numCorrections">Maximum number of corrected characters. Default: 2</param>
		/// <param name="confidence">Confidence of the class of the characters.</param>
		/// <param name="word">Word text after classification and correction.</param>
		/// <param name="score">Measure of similarity between corrected word and uncorrected classification results.</param>
		/// <returns>Result of classifying the characters with the k-NN.</returns>
		// Token: 0x06000BF5 RID: 3061 RVA: 0x0004B6B4 File Offset: 0x000498B4
		public HTuple DoOcrWordKnn(HRegion character, HImage image, string expression, int numAlternatives, int numCorrections, out HTuple confidence, out string word, out double score)
		{
			IntPtr proc = HalconAPI.PreCall(647);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, character);
			HalconAPI.Store(proc, 2, image);
			HalconAPI.StoreS(proc, 1, expression);
			HalconAPI.StoreI(proc, 2, numAlternatives);
			HalconAPI.StoreI(proc, 3, numCorrections);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out confidence);
			num = HalconAPI.LoadS(proc, 2, num, out word);
			num = HalconAPI.LoadD(proc, 3, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(character);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Classify a related group of characters with an OCR classifier.
		///   Instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <param name="character">Characters to be recognized.</param>
		/// <param name="image">Gray values of the characters.</param>
		/// <param name="expression">Expression describing the allowed word structure.</param>
		/// <param name="numAlternatives">Number of classes per character considered for the internal word correction. Default: 3</param>
		/// <param name="numCorrections">Maximum number of corrected characters. Default: 2</param>
		/// <param name="confidence">Confidence of the class of the characters.</param>
		/// <param name="word">Word text after classification and correction.</param>
		/// <param name="score">Measure of similarity between corrected word and uncorrected classification results.</param>
		/// <returns>Result of classifying the characters with the k-NN.</returns>
		// Token: 0x06000BF6 RID: 3062 RVA: 0x0004B76C File Offset: 0x0004996C
		public string DoOcrWordKnn(HRegion character, HImage image, string expression, int numAlternatives, int numCorrections, out double confidence, out string word, out double score)
		{
			IntPtr proc = HalconAPI.PreCall(647);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, character);
			HalconAPI.Store(proc, 2, image);
			HalconAPI.StoreS(proc, 1, expression);
			HalconAPI.StoreI(proc, 2, numAlternatives);
			HalconAPI.StoreI(proc, 3, numCorrections);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num = HalconAPI.CallProcedure(proc);
			string result;
			num = HalconAPI.LoadS(proc, 0, num, out result);
			num = HalconAPI.LoadD(proc, 1, num, out confidence);
			num = HalconAPI.LoadS(proc, 2, num, out word);
			num = HalconAPI.LoadD(proc, 3, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(character);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Deserialize a serialized k-NN-based OCR classifier.
		///   Modified instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x06000BF7 RID: 3063 RVA: 0x0004B824 File Offset: 0x00049A24
		public void DeserializeOcrClassKnn(HSerializedItem serializedItemHandle)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(648);
			HalconAPI.Store(proc, 0, serializedItemHandle);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}

		/// <summary>
		///   Serialize a k-NN-based OCR classifier.
		///   Instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x06000BF8 RID: 3064 RVA: 0x0004B878 File Offset: 0x00049A78
		public HSerializedItem SerializeOcrClassKnn()
		{
			IntPtr proc = HalconAPI.PreCall(649);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Read an OCR classifier from a file.
		///   Modified instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000BF9 RID: 3065 RVA: 0x0004B8C0 File Offset: 0x00049AC0
		public void ReadOcrClassKnn(string fileName)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(650);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write a k-NN classifier for an OCR task to a file.
		///   Instance represents: Handle of the k-NN classifier for an OCR task.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000BFA RID: 3066 RVA: 0x0004B90C File Offset: 0x00049B0C
		public void WriteOcrClassKnn(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(651);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Clear an OCR classifier.
		///   Instance represents: Handle of the OCR classifier.
		/// </summary>
		// Token: 0x06000BFB RID: 3067 RVA: 0x0004B948 File Offset: 0x00049B48
		public void ClearOcrClassKnn()
		{
			IntPtr proc = HalconAPI.PreCall(653);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create an OCR classifier using a k-Nearest Neighbor (k-NN) classifier.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="widthCharacter">Width of the rectangle to which the gray values of the segmented character are zoomed. Default: 8</param>
		/// <param name="heightCharacter">Height of the rectangle to which the gray values of the segmented character are zoomed. Default: 10</param>
		/// <param name="interpolation">Interpolation mode for the zooming of the characters. Default: "constant"</param>
		/// <param name="features">Features to be used for classification. Default: "default"</param>
		/// <param name="characters">All characters of the character set to be read. Default: ["0","1","2","3","4","5","6","7","8","9"]</param>
		/// <param name="genParamName">This parameter is not yet supported. Default: []</param>
		/// <param name="genParamValue">This parameter is not yet supported. Default: []</param>
		// Token: 0x06000BFC RID: 3068 RVA: 0x0004B97C File Offset: 0x00049B7C
		public void CreateOcrClassKnn(int widthCharacter, int heightCharacter, string interpolation, HTuple features, HTuple characters, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(654);
			HalconAPI.StoreI(proc, 0, widthCharacter);
			HalconAPI.StoreI(proc, 1, heightCharacter);
			HalconAPI.StoreS(proc, 2, interpolation);
			HalconAPI.Store(proc, 3, features);
			HalconAPI.Store(proc, 4, characters);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HalconAPI.UnpinTuple(characters);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create an OCR classifier using a k-Nearest Neighbor (k-NN) classifier.
		///   Modified instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="widthCharacter">Width of the rectangle to which the gray values of the segmented character are zoomed. Default: 8</param>
		/// <param name="heightCharacter">Height of the rectangle to which the gray values of the segmented character are zoomed. Default: 10</param>
		/// <param name="interpolation">Interpolation mode for the zooming of the characters. Default: "constant"</param>
		/// <param name="features">Features to be used for classification. Default: "default"</param>
		/// <param name="characters">All characters of the character set to be read. Default: ["0","1","2","3","4","5","6","7","8","9"]</param>
		/// <param name="genParamName">This parameter is not yet supported. Default: []</param>
		/// <param name="genParamValue">This parameter is not yet supported. Default: []</param>
		// Token: 0x06000BFD RID: 3069 RVA: 0x0004BA18 File Offset: 0x00049C18
		public void CreateOcrClassKnn(int widthCharacter, int heightCharacter, string interpolation, string features, HTuple characters, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(654);
			HalconAPI.StoreI(proc, 0, widthCharacter);
			HalconAPI.StoreI(proc, 1, heightCharacter);
			HalconAPI.StoreS(proc, 2, interpolation);
			HalconAPI.StoreS(proc, 3, features);
			HalconAPI.Store(proc, 4, characters);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(characters);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Trains an k-NN classifier for an OCR task.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="trainingFile">Names of the training files. Default: "ocr.trf"</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
		// Token: 0x06000BFE RID: 3070 RVA: 0x0004BAB0 File Offset: 0x00049CB0
		public void TrainfOcrClassKnn(HTuple trainingFile, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(655);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, trainingFile);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(trainingFile);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Trains an k-NN classifier for an OCR task.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="trainingFile">Names of the training files. Default: "ocr.trf"</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
		// Token: 0x06000BFF RID: 3071 RVA: 0x0004BB10 File Offset: 0x00049D10
		public void TrainfOcrClassKnn(string trainingFile, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(655);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, trainingFile);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Compute the features of a character.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="character">Input character.</param>
		/// <param name="transform">Should the feature vector be transformed with the preprocessing? Default: "true"</param>
		/// <returns>Feature vector of the character.</returns>
		// Token: 0x06000C00 RID: 3072 RVA: 0x0004BB68 File Offset: 0x00049D68
		public HTuple GetFeaturesOcrClassKnn(HImage character, string transform)
		{
			IntPtr proc = HalconAPI.PreCall(656);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, character);
			HalconAPI.StoreS(proc, 1, transform);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(character);
			return result;
		}

		/// <summary>
		///   Return the parameters of an OCR classifier.
		///   Instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <param name="widthCharacter">Width of the rectangle to which the gray values of the segmented character are zoomed.</param>
		/// <param name="heightCharacter">Height of the rectangle to which the gray values of the segmented character are zoomed.</param>
		/// <param name="interpolation">Interpolation mode for the zooming of the characters.</param>
		/// <param name="features">Features to be used for classification.</param>
		/// <param name="characters">Characters of the character set to be read.</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors.</param>
		/// <param name="numTrees">Number of different trees used during the classifcation.</param>
		// Token: 0x06000C01 RID: 3073 RVA: 0x0004BBC8 File Offset: 0x00049DC8
		public void GetParamsOcrClassKnn(out int widthCharacter, out int heightCharacter, out string interpolation, out HTuple features, out HTuple characters, out string preprocessing, out int numTrees)
		{
			IntPtr proc = HalconAPI.PreCall(657);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			HalconAPI.InitOCT(proc, 5);
			HalconAPI.InitOCT(proc, 6);
			int num = HalconAPI.CallProcedure(proc);
			num = HalconAPI.LoadI(proc, 0, num, out widthCharacter);
			num = HalconAPI.LoadI(proc, 1, num, out heightCharacter);
			num = HalconAPI.LoadS(proc, 2, num, out interpolation);
			num = HTuple.LoadNew(proc, 3, num, out features);
			num = HTuple.LoadNew(proc, 4, num, out characters);
			num = HalconAPI.LoadS(proc, 5, num, out preprocessing);
			num = HalconAPI.LoadI(proc, 6, num, out numTrees);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Return the parameters of an OCR classifier.
		///   Instance represents: Handle of the OCR classifier.
		/// </summary>
		/// <param name="widthCharacter">Width of the rectangle to which the gray values of the segmented character are zoomed.</param>
		/// <param name="heightCharacter">Height of the rectangle to which the gray values of the segmented character are zoomed.</param>
		/// <param name="interpolation">Interpolation mode for the zooming of the characters.</param>
		/// <param name="features">Features to be used for classification.</param>
		/// <param name="characters">Characters of the character set to be read.</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors.</param>
		/// <param name="numTrees">Number of different trees used during the classifcation.</param>
		// Token: 0x06000C02 RID: 3074 RVA: 0x0004BC80 File Offset: 0x00049E80
		public void GetParamsOcrClassKnn(out int widthCharacter, out int heightCharacter, out string interpolation, out string features, out HTuple characters, out string preprocessing, out int numTrees)
		{
			IntPtr proc = HalconAPI.PreCall(657);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			HalconAPI.InitOCT(proc, 5);
			HalconAPI.InitOCT(proc, 6);
			int num = HalconAPI.CallProcedure(proc);
			num = HalconAPI.LoadI(proc, 0, num, out widthCharacter);
			num = HalconAPI.LoadI(proc, 1, num, out heightCharacter);
			num = HalconAPI.LoadS(proc, 2, num, out interpolation);
			num = HalconAPI.LoadS(proc, 3, num, out features);
			num = HTuple.LoadNew(proc, 4, num, out characters);
			num = HalconAPI.LoadS(proc, 5, num, out preprocessing);
			num = HalconAPI.LoadI(proc, 6, num, out numTrees);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Classify multiple characters with an k-NN classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="character">Characters to be recognized.</param>
		/// <param name="image">Gray values of the characters.</param>
		/// <param name="confidence">Confidence of the class of the characters.</param>
		/// <returns>Result of classifying the characters with the k-NN.</returns>
		// Token: 0x06000C03 RID: 3075 RVA: 0x0004BD38 File Offset: 0x00049F38
		public HTuple DoOcrMultiClassKnn(HRegion character, HImage image, out HTuple confidence)
		{
			IntPtr proc = HalconAPI.PreCall(658);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, character);
			HalconAPI.Store(proc, 2, image);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out confidence);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(character);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Classify multiple characters with an k-NN classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="character">Characters to be recognized.</param>
		/// <param name="image">Gray values of the characters.</param>
		/// <param name="confidence">Confidence of the class of the characters.</param>
		/// <returns>Result of classifying the characters with the k-NN.</returns>
		// Token: 0x06000C04 RID: 3076 RVA: 0x0004BDB0 File Offset: 0x00049FB0
		public string DoOcrMultiClassKnn(HRegion character, HImage image, out double confidence)
		{
			IntPtr proc = HalconAPI.PreCall(658);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, character);
			HalconAPI.Store(proc, 2, image);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			string result;
			num = HalconAPI.LoadS(proc, 0, num, out result);
			num = HalconAPI.LoadD(proc, 1, num, out confidence);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(character);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Classify a single character with an OCR classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="character">Character to be recognized.</param>
		/// <param name="image">Gray values of the character.</param>
		/// <param name="numClasses">Number of maximal classes to determine. Default: 1</param>
		/// <param name="numNeighbors">Number of neighbors to consider. Default: 1</param>
		/// <param name="confidence">Confidence(s) of the class(es) of the character.</param>
		/// <returns>Results of classifying the character with the k-NN.</returns>
		// Token: 0x06000C05 RID: 3077 RVA: 0x0004BE28 File Offset: 0x0004A028
		public HTuple DoOcrSingleClassKnn(HRegion character, HImage image, HTuple numClasses, HTuple numNeighbors, out HTuple confidence)
		{
			IntPtr proc = HalconAPI.PreCall(659);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, character);
			HalconAPI.Store(proc, 2, image);
			HalconAPI.Store(proc, 1, numClasses);
			HalconAPI.Store(proc, 2, numNeighbors);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numClasses);
			HalconAPI.UnpinTuple(numNeighbors);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out confidence);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(character);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Classify a single character with an OCR classifier.
		///   Instance represents: Handle of the k-NN classifier.
		/// </summary>
		/// <param name="character">Character to be recognized.</param>
		/// <param name="image">Gray values of the character.</param>
		/// <param name="numClasses">Number of maximal classes to determine. Default: 1</param>
		/// <param name="numNeighbors">Number of neighbors to consider. Default: 1</param>
		/// <param name="confidence">Confidence(s) of the class(es) of the character.</param>
		/// <returns>Results of classifying the character with the k-NN.</returns>
		// Token: 0x06000C06 RID: 3078 RVA: 0x0004BEC0 File Offset: 0x0004A0C0
		public string DoOcrSingleClassKnn(HRegion character, HImage image, HTuple numClasses, HTuple numNeighbors, out double confidence)
		{
			IntPtr proc = HalconAPI.PreCall(659);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, character);
			HalconAPI.Store(proc, 2, image);
			HalconAPI.Store(proc, 1, numClasses);
			HalconAPI.Store(proc, 2, numNeighbors);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numClasses);
			HalconAPI.UnpinTuple(numNeighbors);
			string result;
			num = HalconAPI.LoadS(proc, 0, num, out result);
			num = HalconAPI.LoadD(proc, 1, num, out confidence);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(character);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Select an optimal combination of features to classify OCR data.
		///   Modified instance represents: Trained OCR-k-NN classifier.
		/// </summary>
		/// <param name="trainingFile">Names of the training files. Default: ""</param>
		/// <param name="featureList">List of features that should be considered for selection. Default: ["zoom_factor","ratio","width","height","foreground","foreground_grid_9","foreground_grid_16","anisometry","compactness","convexity","moments_region_2nd_invar","moments_region_2nd_rel_invar","moments_region_3rd_invar","moments_central","phi","num_connect","num_holes","projection_horizontal","projection_vertical","projection_horizontal_invar","projection_vertical_invar","chord_histo","num_runs","pixel","pixel_invar","pixel_binary","gradient_8dir","cooc","moments_gray_plane"]</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="width">Width of the rectangle to which the gray values of the segmented character are zoomed. Default: 15</param>
		/// <param name="height">Height of the rectangle to which the gray values of the segmented character are zoomed. Default: 16</param>
		/// <param name="genParamName">Names of generic parameters to configure the selection process and the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure the selection process and the classifier. Default: []</param>
		/// <param name="score">Achieved score using tow-fold cross-validation.</param>
		/// <returns>Selected feature set, contains only entries from FeatureList.</returns>
		// Token: 0x06000C07 RID: 3079 RVA: 0x0004BF58 File Offset: 0x0004A158
		public HTuple SelectFeatureSetTrainfKnn(HTuple trainingFile, HTuple featureList, string selectionMethod, int width, int height, HTuple genParamName, HTuple genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(660);
			HalconAPI.Store(proc, 0, trainingFile);
			HalconAPI.Store(proc, 1, featureList);
			HalconAPI.StoreS(proc, 2, selectionMethod);
			HalconAPI.StoreI(proc, 3, width);
			HalconAPI.StoreI(proc, 4, height);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(trainingFile);
			HalconAPI.UnpinTuple(featureList);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Select an optimal combination of features to classify OCR data.
		///   Modified instance represents: Trained OCR-k-NN classifier.
		/// </summary>
		/// <param name="trainingFile">Names of the training files. Default: ""</param>
		/// <param name="featureList">List of features that should be considered for selection. Default: ["zoom_factor","ratio","width","height","foreground","foreground_grid_9","foreground_grid_16","anisometry","compactness","convexity","moments_region_2nd_invar","moments_region_2nd_rel_invar","moments_region_3rd_invar","moments_central","phi","num_connect","num_holes","projection_horizontal","projection_vertical","projection_horizontal_invar","projection_vertical_invar","chord_histo","num_runs","pixel","pixel_invar","pixel_binary","gradient_8dir","cooc","moments_gray_plane"]</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="width">Width of the rectangle to which the gray values of the segmented character are zoomed. Default: 15</param>
		/// <param name="height">Height of the rectangle to which the gray values of the segmented character are zoomed. Default: 16</param>
		/// <param name="genParamName">Names of generic parameters to configure the selection process and the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure the selection process and the classifier. Default: []</param>
		/// <param name="score">Achieved score using tow-fold cross-validation.</param>
		/// <returns>Selected feature set, contains only entries from FeatureList.</returns>
		// Token: 0x06000C08 RID: 3080 RVA: 0x0004C01C File Offset: 0x0004A21C
		public HTuple SelectFeatureSetTrainfKnn(string trainingFile, string featureList, string selectionMethod, int width, int height, HTuple genParamName, HTuple genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(660);
			HalconAPI.StoreS(proc, 0, trainingFile);
			HalconAPI.StoreS(proc, 1, featureList);
			HalconAPI.StoreS(proc, 2, selectionMethod);
			HalconAPI.StoreI(proc, 3, width);
			HalconAPI.StoreI(proc, 4, height);
			HalconAPI.Store(proc, 5, genParamName);
			HalconAPI.Store(proc, 6, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}
	}
}
